/*
* This is a dummy MSROLL program used for debugging and
* demonstration.  The program can be executed with two
* parameters for input files.  The program writes the names
* of these files to a file named "msroll.log" to indicate
* the proper file names have been read.  The program also
* write "running" to a "status.txt" file.
* @author David Beaver
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>

const char *inputFile;      /* -f option */
const char *inputRadii;	/* -r option */


static const char *optString = "f:r:";
int main(int argc, char*argv[]){
    int opt = 0;
    /* Initialize globalArgs before we get */
    int statusFile;
    char *filename = "./status.txt";
    char *status = "running\n";
    statusFile = creat(filename,O_CREAT|O_RDWR|S_IRWXU);
    write(statusFile,status,strlen(status));
    close(statusFile);
    //fprintf(stderr,"%d errors\n",0);
    opt = getopt( argc, argv, optString );
    while( opt != -1 ) {
        switch(opt){ 
                
            case 'f':
                inputFile = optarg;
                break;
                
            case 'r':
                inputRadii = optarg;
                
                
            default:
                /* You won't actually get here. */
                break;
        }
        
        opt = getopt( argc, argv, optString );
    }	
    printf("input file: %s\n",inputFile);
    
    printf("input radii: %s\n",inputRadii);
    return 0; 	
}